﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GoogleAppsTools
{
    /// <summary>
    /// Class that contains all the details of a new email.
    /// </summary>
    class NewMail : IEquatable<NewMail>
    {
        private string title;
        private string summary;
        private string link;
        private string senderName;
        private DateTime received;
        private string senderEmail;

        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        public string Summary
        {
            get { return summary; }
        }

        public string Link
        {
            get { return link; }
        }

        public string SenderName
        {
            get { return senderName; }
        }

        public string SenderEmail
        {
            get { return senderEmail; }
        }
        

        public DateTime Received
        {
            get { return received; }
        }

        /// <summary>
        /// Class that contains all the details of a new email.
        /// </summary>
        /// <param name="title">The title of the email</param>
        /// <param name="summary">The short email summary</param>
        /// <param name="link">A link to read the full email</param>
        /// <param name="from">Who the email is from</param>
        /// <param name="received">The date and time received</param>
        public NewMail(string title, string summary, string link, string senderName, string senderEmail, DateTime received)
        {
            this.title = title;
            this.summary = summary;
            this.link = link;
            this.senderName = senderName;
            this.senderEmail = senderEmail;
            this.received = received;
        }

        public bool Equals(NewMail other)
        {
            if (this.Title == other.Title &&
                this.Summary == other.Summary &&
                this.Link == other.Link &&
                this.SenderName == other.SenderName &&
                this.SenderEmail == other.SenderEmail &&
                this.Received == other.Received)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
